import request from "@/utils/request";

/**
 * 系统用户接口
 */

// 登录
export const login = (data) => {
  return request({
    method: "post",
    url: "/adminUser/login",
    data,
  });
};

// 退出
export const logout = () => {
  return request({
    method: "GET",
    url: "/adminUser/logout",
  });
};

// 获取验证码
export const code = () => {
  return request({
    method: "GET",
    url: "/adminUser/code",
  });
};

// 获取用户信息
export const getUserInfo = () => {
  return request({
    method: "GET",
    url: "/adminUser/profile",
  });
};



// 修改用户密码
export const updatePwd = (sysUserId, newPwd) => {
  return request({
    method: "PUT",
    url: `/adminUser/updatePwd/${sysUserId}`,
    params: {
      newPwd
    }
  });
};

// 修改账号状态
export const changeStatus = (sysUserId, status) => {
  return request({
    method: "PUT",
    url: `/adminUser/${sysUserId}/${status}`,
  });
};

// 删除用户
export const deleteUser = (sysUserId) => {
  return request({
    method: "DELETE",
    url: `/adminUser/${sysUserId}`,
  });
};

// 分页查询会员列表。实现了搜索功能
export const pagingQuery = (params) => {
  return request({
    method: "GET",
    url: "/adminUser/pagingQuery",
    params
  })
}